Skip to content

pull in latest upstream#2

Open
TtheBC01 wants to merge 721 commits into
1Shot-API:mainfrom
x402-foundation:main
Open

pull in latest upstream#2
TtheBC01 wants to merge 721 commits into
1Shot-API:mainfrom
x402-foundation:main

Conversation

@TtheBC01

Copy link
Copy Markdown

Description

Tests

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

vijaygopalbalasa and others added 18 commits March 30, 2026 16:00
Add native USDC (0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359) as the
default stablecoin for Polygon mainnet across all three SDKs:

- Go: ChainIDPolygon constant, v2 NetworkConfigs, v1 NetworkConfigs
- TypeScript: v2 stablecoins map in ExactEvmScheme
- Python: v2 NETWORK_CONFIGS with supported_assets

Update Go v1 unit tests that previously used "polygon" as a network
without a default asset config. Replace with "iotex" and add positive
test coverage for Polygon config and asset resolution.

Contract details (verified on-chain via PolygonScan):
- Token: Circle native USDC (FiatTokenV2_2)
- EIP-712 domain: name="USD Coin", version="2"
- EIP-3009: transferWithAuthorization supported
- x402 proxy deployed at canonical CREATE2 address
* fix(mcp): preserve structuredContent in payment wrapper result

createPaymentWrapper was reconstructing the tool result with only
content/isError/_meta, dropping structuredContent. This causes MCP SDK
output schema validation to fail with "Tool has an output schema but
no structured content was provided" for any tool that defines an
outputSchema.

Fix: spread the full handler result instead of cherry-picking fields,
so structuredContent and any future fields are preserved.

Adds test verifying structuredContent survives the payment wrapper.

* fix(mcp): drop result._meta spread to fix TS2698

The index signature on ToolResult makes _meta typed as unknown,
which cannot be spread. The wrapper owns _meta exclusively so
no merge is needed.
* Fix HTTPFacilitatorClient not following 308 redirects from facilitator

The x402.org/facilitator/supported endpoint returns HTTP 308 before
resolving to 200. HTTPFacilitatorClient did not normalize the base URL
or explicitly request redirect following, causing syncFacilitatorOnStart
to silently fail in some runtimes. When no supported payment kinds are
loaded, the middleware passes all requests through as 200 instead of 402.

- Strip trailing slashes from facilitator URL in constructor to prevent
  unnecessary 308 redirects from trailing-slash normalization
- Explicitly set redirect: "follow" on all fetch calls (verify, settle,
  getSupported) for cross-runtime compatibility
- Add tests for URL normalization and redirect option propagation

Closes #1692

* fix: apply prettier formatting to httpFacilitatorClient test
* test(python): add missing sync test scenarios to existing test_server.py

Add edge case coverage for: missing/malformed _meta, no matching
requirements, MCPToolResult direct return, non-dict handler return,
structuredContent preservation, empty accepts validation, verification
failure without reason, and hook context field verification.

* fix: apply ruff format to test_server.py

* fix formatting: match existing test style, inline data construction, fix import order
* fix: evm contract deploys

* feat: updated constants in SDKs

* feat: added changeset fragments
* feat(evm): add Stable testnet (chain ID 2201) network support

* style(go): fix gofmt alignment for chain ID variable declarations

* fix(python): remove supported_assets from Stable network configs

* style(ts): reorder Stable configs above Polygon/Arbitrum in defaultAssets
* feat: refactor coinbase/x402 references to x402-foundation/x402

* fix: format

* chore: changeset fragments for typescript, python and go
* chore: version typescript packages

* chore: version python package

* chore: version go package
* add self-facilitation example

* fix: regenerate examples/typescript lockfile against public npm registry

Lockfile had tarball URLs pointing to internal Coinbase Artifactory, causing
pnpm install to fail with ENOTFOUND in CI where that host is unreachable.
AnilChinchawale and others added 30 commits June 11, 2026 12:43
* validAfter patch

* add changelogs

* fix fmt
* add daily e2e runs

* fix parallel e2e

* fix tests

* fix next

* fix tests

* fix env
…ettlements (#2607)

The upto EVM spec's Phase 3 step 4 requires `permitted.amount ===
requirements.amount`, but doesn't distinguish verify-time (where
requirements.amount is the ceiling) from settle-time (where
requirements.amount is the metered actual). This ambiguity allows
facilitator implementations to enforce the equality check at settle
time, rejecting all partial settlements — the core upto value
proposition.

Add an explicit "Settle-Time Verification" subsection to Phase 4 that
documents the convention the reference implementation already follows:
verify the signature against permitted.amount (the ceiling), validate
settlement <= ceiling, then transfer the metered amount on-chain.

Include a conformance note, a wire-shape example for the partial
settlement case, and a cross-reference from the abstract scheme_upto.md.

Add four conformance tests to the EVM facilitator test suite that
validate the settle-time verification convention end-to-end: signature
verified against ceiling, metered amount transferred on-chain, range of
partial ratios, and rejection when exceeding the ceiling.

Closes #2437

Co-authored-by: aisling404 <211950534+aisling404@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* add buildercode s array

* add changelog

* fix
* Update docs/extensions/builder-code.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/builder-code.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/builder-code.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/builder-code.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/builder-code.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/builder-code.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
* feat(tvm): add TON mechanism for exact payment scheme

Add @x402/tvm (TypeScript) and x402[tvm] (Python) mechanism packages
implementing the exact payment scheme for TON blockchain.

Python (mechanisms/tvm/):
- Full gasless USDT payment flow via TONAPI relay
- Ed25519 signature verification for W5R1 wallets
- BoC parser for external messages, jetton transfers
- 6-rule payment verification (protocol, signature, intent, replay,
  relay safety, simulation)
- Idempotent settlement with state machine
- 72 unit tests

TypeScript (@x402/tvm):
- SchemeNetworkClient/Server/Facilitator implementations
- W5R1 wallet signing with @ton/ton SDK
- Gasless estimate + settlement via TONAPI
- CAIP-2 network IDs: tvm:-239 (mainnet), tvm:-3 (testnet)
- 48 unit tests

Refs: spec PR #1455, live facilitator at ton-facilitator.okhlopkov.com

* fix(tvm): address code review — Ed25519 verification, stateInit, httpx dep

- TS facilitator: add full Ed25519 signature verification using tweetnacl
- TS client: compute commission from gasless estimate, propagate stateInit
- Python: add httpx to tvm extras, lazy-import TonapiProvider
- Update facilitator tests with real cryptographic fixtures

* feat(tvm): update to self-relay architecture — remove gasless, add /prepare flow

* fix(tvm): align TS/Python API contracts, delegate verify to facilitator

Codex review fixes:
- TS client /prepare now sends {walletAddress, walletPublicKey, paymentRequirements}
  matching Python and the actual facilitator API
- TS facilitator delegates verify/settle to facilitator HTTP service instead of
  local BoC parsing (fixes security gap: was checking JSON fields but not BoC content)
- TS /settle sends x402 envelope format matching facilitator API
- validUntil comes from facilitator /prepare response, not invented locally
- Remove unused error constants and Cell import
- Update README: self-relay architecture, remove gasless/toFacilitatorTvmSigner docs
- Update client tests to mock fetch instead of removed signer methods
- Update changelog: "self-relay gas sponsorship" instead of "gasless"

* chore(tvm): add all_networks examples, revert unrelated core changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(tvm): support both camelCase and snake_case facilitator responses

The TVM facilitator scheme now accepts both response formats from
the facilitator API, ensuring compatibility with facilitators that
use either convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(tvm): client uses RPC instead of /prepare — remove nonce

Breaking changes:
- Client resolves seqno + jetton wallet via TON RPC (default: toncenter.com)
- ExactTvmScheme constructor now accepts optional { rpcUrl, apiKey }
- Removed nonce from TvmPaymentPayload (dedup uses BoC hash)
- Facilitator dedup tracks BoC hashes instead of nonces

Aligns with spec review: no /prepare endpoint, client uses standard
RPC calls like SVM/Stellar/Aptos.

* fix(tvm): respect maxTimeoutSeconds from requirements

- Client uses paymentRequirements.maxTimeoutSeconds for validUntil
  instead of hardcoded 300s
- Facilitator forwards maxTimeoutSeconds to external /verify and /settle

* chore(tvm): remove unused @ton-api deps, move tweetnacl to devDeps

@ton-api/client and @ton-api/ton-adapter were leftover from the
gasless relay approach. tweetnacl is only used in tests.

* refactor: internal message BoC format, minimal payload

Address TON Core team review feedback:
- settlementBoc encodes internal message (not external)
- Payload reduced to {settlementBoc, asset} only
- Remove redundant fields (from, to, amount, walletPublicKey)
- Set bounce=true on internal messages
- Remove facilitatorUrl from PaymentRequirements extra

* fix(tvm): align TS SDK with Python TVM flows

* chore(tvm): update examples lockfile

* fix(tvm): implement native TS facilitator

* fix(tvm): address final review feedback

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* add contributing skill

* add ai policy
* feat(typescript): add keeta mechanism implementation

* feat(keeta): queue settlement requests per feePayer account

* chore(keeta): upgrade keetanet-client 0.16.1, anchor 0.0.50

* feat(keeta): add transaction simulation implementation

* refactor(keeta): remove legacy register helper and use builder directly

* feat(keeta): add typescript examples

* feat(keeta): add to example facilitator

* feat(keeta): add github publishing workflow

* feat(keeta): add to docs

* feat(keeta): add docs to README

* feat(keeta): add unit and integration tests

* feat(keeta): add e2e tests

* feat(keeta): determine KTA/USDC via SDK, logger for facilitator

And also contains a few other minor fixes.

* chore(keeta): upgrade to keetanet-client 0.18.1, anchor 0.0.77

* fix(keeta): working e2e tests and add for hono, next, fastify

* feat(keeta): update CI publish workflow and add to all

* feat(keeta): harden facilitator CAIP parsing and moving its own funds

* refactor(keeta): use @x402/core/utils for money parsing

* feat(site): derive multiple Keeta signers from facilitator passphrase

This enables the demo facilitator to run with multiple signers for Keeta
by specifying a single passphrase and an amount of signers to use.

* fix(keeta): pass duplicate_block error and avoid race in queue

This now passes the `duplicate_block` error to clients instead of
swallowing it silently and only passing a generic transaction_failed
errorReason.

Also, we fix a potential race condition where a running queue worker
could pick up a job before the corresponding promise was added leading
to the job failing and the promise becoming stuck.

* fix(keeta): cleanup UserClients via destroy or await using

* refactor(keeta): rename passphrase to mnemonic

We decided that mnemonic would be clearer to most users/devs than
passphrase which outweighs aligning the terminology with the SDK (which
uses Account.seedFromPassphrase) and so replaced Keeta-related
passphrase with mnemonic.
* Update docs/sdk-features.md

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/sdk-features.md

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
* tvm/keeta followups

* fix fmt
…ation (#2653)

* fix siwx echo

* fix offer-receipt

* same for go

* fix fmt
Co-authored-by: go165 <196723798+go165@users.noreply.github.com>
* Update docs/extensions/overview.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/overview.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
* feat(go): add sign-in-with-x extension helpers

* docs(go): add sign-in-with-x implementation plan

* feat(go): add sign-in-with-x server extension

* feat(go): add sign-in-with-x evm client signing

* feat(go): retry sign-in-with-x auth before payment

* docs(go): add sign-in-with-x examples

* fix(go): satisfy sign-in-with-x lint checks

* docs(go): update sign-in-with-x changelog

* feat(go): add SIWX smart wallet verification

* chore(go): tidy sign-in-with-x server example

* docs(go): remove SIWX implementation plan

* fix(go): align SIWX examples with TS interop

* fix(go): address SIWX interop review feedback
* Update docs/extensions/sign-in-with-x.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/sign-in-with-x.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/extensions/sign-in-with-x.mdx

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

* Update docs/sdk-features.md

Generated-By: mintlify-agent

Mintlify-Source: dashboard-editor

---------

Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.